<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script src="../src/javascript/lib/nej/define.js"></script>

<script>
    define([
        'util/ajax/xdr',
        'util/cache/cache'
    ],function (_ajax,_cache,_p) {
        var cache = _cache._$$CacheAbstract._$allocate({
            ondataload: function (data) {
                alert('ondataload：' + data.key );
            }
        });
        cache.__setDataInCache("a",1);
        cache.__setDataInCache("b",2);
        cache.__setDataInStorage("a", 1);
        var cb1 = function () {
            alert(1);
        };

        var cb2 = function () {
            alert(2);
        };
        cache.__doQueueRequest('random-key', cache._$dispatchEvent._$bind(cache,'ondataload',{key:'random'})); // 添加回调函数到队列
        cache.__doQueueRequest('aa-key', cb2); // 添加回调函数到队列
        cache.__doCallbackRequest('random-key');  // 调用对应key的回调请求
        cache.__doCallbackRequest('aa-key');  // 调用对应key的回调请求
        console.log('缓存抽象实例对象：', cache);
        console.log(cache.__cache);
    })
</script>
</body>
</html>